//
//  ZTLinkageInfo.h
//  YSSmartHome
//
//  Created by Yahaong on 16/9/6.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ZTDevice.h"
#import "ZTLinkageConfig.h"
#import <XAISDK/XAILinkItemDes.h>
@interface ZTLinkageInfo : NSObject

@property (assign, readonly) XAITYPEAPSN dev_apsn;
@property (assign, readonly) XAITYPELUID dev_luid;
@property (assign, readonly) int some_id;
//@property (assign, readonly) packet_param_data* datas;
@property (nonatomic, strong) ZTDevice*device;
@property (nonatomic, assign) ZTLinkageType linkageType;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *strSelectDesc;
@property (nonatomic, copy) NSString *strNormalDesc;
@property (nonatomic, strong) XAILinkItemDes* linkItemDes;

//- (void) setApsn:(XAITYPEAPSN)apsn Luid:(XAITYPELUID)luid ID:(int)ID Datas:(packet_param_data*)datas;
//- (void) setApsn:(XAITYPEAPSN)apsn Luid:(XAITYPELUID)luid ID:(int)ID device:(ZTDevice *)device Datas:(packet_param_data*)datas ;
@end
/*控制信息作为联动条件 开灯(一个操作)*/
@interface ZTLinkageInfoCtrl : ZTLinkageInfo

@end



/*状态信息作为联动条件 门打开时(固定状态)*/
@interface ZTLinkageInfoStatus : ZTLinkageInfo{
    
    float _otherValue;
}

@end

/*可变的状态信息作为联动条件  温度大于多少度(可变状态)*/
@interface ZTLinkageInfoStatusMutable : ZTLinkageInfoStatus

@end

@class LinkageTimeStruct;
@interface LinkageUseInfoTime : ZTLinkageInfoStatus

@property (nonatomic,assign) XAITYPETIME time;
@property (nonatomic,strong) LinkageTimeStruct* timeStruct;


- (void)change;


@end
typedef NS_ENUM(NSUInteger, Linkage_Time_Dimension) {
    Linkage_Time_Dimension_Day,
    Linkage_Time_Dimension_Mouth,
    Linkage_Time_Dimension_Year,
    Linkage_Time_Dimension_All, /*表示整个时间长度*/
};
//gmt 时间
@interface LinkageTimeStruct : NSObject{
    uint8_t _flag;
    uint8_t _wday;
    uint64_t _year;  /*从2000年开始计数*/
    uint16_t _mouth;
    uint32_t _mday;
    uint8_t _hour;
    uint8_t _min;
    uint8_t _sec;
    Linkage_Time_Dimension  _dimension;
}

- (LinkageTimeStruct *)initWith:(uint8_t)flag wday:(uint8_t)wday year:(uint64_t)year mouth:(uint16_t)mouth data:(NSDate *)date;
- (void) setDate:(NSDate*)date wdays:(NSArray *)wdays dimension:(Linkage_Time_Dimension)dimension;
- (uint8_t *)getBinary;
- (void) setDateFromBData:(NSData*)bData;
- (NSString*) toStr;
@end
